#include "pullcuber.h"
#include "standalonecuber.h"
#include "cuberproxy.h"

const char* CCuberProxy::CuberConnTypeTcp = "TCP";
const char* CCuberProxy::CuberConnTypeUdp = "UDP";
const char* CCuberProxy::CuberConnTypeP4p = "P4P";

CCuberProxy::CCuberProxy(CCuber* cuber):
mActiveCuber(cuber)
{
}
CCuberProxy::CCuberProxy(){
}
CCuberProxy::~CCuberProxy(){
  delete mActiveCuber;
}
CCuberProxy*
CCuberProxy::Connect(const char* parameters){
  UDK_HANDLE h = mActiveCuber->Connect(parameters);
  if(NULL!=h){
    myhandle = h;
    return this;
  }
  return NULL;
}
void 
CCuberProxy::Disconnect(void){
  mActiveCuber->Disconnect(myhandle);
}
int CCuberProxy::GetLastError(void)
{
  return mActiveCuber->GetLastError();
}

int 
CCuberProxy::SearchDevices(char *CommType,char *Address, char *Buffer,int *BufferLength)
{
  return mActiveCuber->SearchDevices(CommType,Address,Buffer,BufferLength);
}

int CCuberProxy::GetLockCount()
{
  return mActiveCuber->GetLockCount(myhandle);
}
  
int CCuberProxy::SetLockState(int lock_no,int opentime){
  return mActiveCuber->SetLockState(myhandle,lock_no,opentime);
}
int CCuberProxy::GetLockState(int lock_no){
  return mActiveCuber->GetLockState(myhandle,lock_no);
}

int CCuberProxy::GetComPwd(char *buffer, int *BufferLen) {
    return mActiveCuber->GetComPwd(myhandle, buffer, BufferLen);
}

int CCuberProxy::MobileAtt(int operate, char *premeters, char *Buffer,int *BufferLength)
{
	return mActiveCuber->MobileAtt(myhandle, operate, premeters, Buffer, BufferLength);

}

int CCuberProxy::GetDeviceParam(char *Buffer, int Bufferlen, char *Item)
{
	return mActiveCuber->GetDeviceParam(myhandle, Buffer, Bufferlen, Item);

}
int CCuberProxy::SetDeviceParam(char *ItemandValues)
{
	return mActiveCuber->SetDeviceParam(myhandle, ItemandValues);
}

int CCuberProxy::SetDownloadProcessCallBack(void *pCallBackFun)
{
	return mActiveCuber->SetDownloadProcessCallBack(myhandle, pCallBackFun);
}

int CCuberProxy::ResetDeviceExt(char *parameters)
{
	return mActiveCuber->ResetDeviceExt(myhandle, parameters);
}




